﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RaiderManagerBackend
{
    public class Raid
    {
        private DateTime _date;
        private List<Encounter> _bosses = new List<Encounter>();
        private int _raidId;
        private List<AttendanceEntry> _attendanceEntries = new List<AttendanceEntry>();

        public DateTime Date
        {
            get { return _date; }
            set { _date = value; }
        }

        public List<Encounter> Bosses
        {
            get { return _bosses; }
            private set { _bosses = value; }
        }

        public int RaidId
        {
            get { return _raidId; }
            set { _raidId = value; }
        }

        public List<AttendanceEntry> AttendanceEntries
        {
            get { return _attendanceEntries; }
        }

        public void BuildAttendance()
        {
            SQLiteCommunicator comm = new SQLiteCommunicator();
            this._attendanceEntries = comm.BuildAttendanceForRaid(this);
        }

        public void BuildEncounters()
        {
            SQLiteCommunicator comm = new SQLiteCommunicator();
            this.Bosses = comm.BuildEncountersForRaid(this);
        }

        public void SaveRaid()
        {
            SQLiteCommunicator comm = new SQLiteCommunicator();
            RaidId = comm.AddUpdateRaid(this);
        }

        public override string ToString()
        {
            return Date.ToString("M/dd/yyyy");
        }
    }
}
